package service;

import dao.UserDao;
import pojo.User;

import java.sql.SQLException;
import java.util.ArrayList;

public class UserService {
    UserDao ud=new UserDao();

    public User login(String name, String pwd) {
        User u=null;
        String sql="select * from user where username='"+name+"' and password='"+pwd+"'";
        try {
            ArrayList<User> userList=ud.findUserBySql(sql);
            if(userList.size()>0) {
                u=userList.get(0);
            }
        } catch (SQLException e) {
            e.printStackTrace();
        }

        return u;
    }
}